package com.luguokong.pet_rescue.service;


import com.luguokong.pet_rescue.mapper.PetMapper;
import com.luguokong.pet_rescue.pojo.Pet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PetService {

    @Autowired
    private PetMapper petMapper;

    public int insertPet(Pet pet){
        int i = petMapper.insertPet(pet);
        return i;
    }
    public int deletePetById(int pet_id){
        int i = petMapper.deletePetById(pet_id);
        return i;
    }
    public int updatePetById(Pet pet){
        int i = petMapper.updatePetById(pet);
        return i;
    }
    public Pet selectPetById(int pet_id){
        Pet pet = petMapper.selectPetById(pet_id);
        return pet;
    }
    public List<Pet> selectPetAll(){
        List<Pet> petList = petMapper.selectPetAll();
        return petList;
    }
    public List<Pet> selectPetAllByType(String pet_type){
        List<Pet> petList = petMapper.selectPetAllByType(pet_type);
        return petList;
    }
    public List<Pet> selectPetAllBySpecies(String pet_species){
        List<Pet> petList = petMapper.selectPetAllBySpecies(pet_species);
        return petList;
    }
    public List<Pet> selectPetAllByIsAdopt(){
        List<Pet> petList = petMapper.selectPetAllByIsAdopt();
        return petList;
    }
    public List<Pet> selectPetAllByIsNotAdopt(){
        List<Pet> petList = petMapper.selectPetAllByIsNotAdopt();
        return petList;
    }
    public List<Pet> selectPetAllByRecentIsAdopt(){
        List<Pet> petList = petMapper.selectPetAllByRecentIsAdopt();
        return petList;
    }
    public List<Pet> selectPetAllByIsAdoptByUserId(int user_id){
        List<Pet> petList = petMapper.selectPetAllByIsAdoptByUserId(user_id);
        return petList;
    }
//    分页查询
    public List<Pet> selectPetAllByPageNumByPageSize(int pageNum, int pageSize){
        List<Pet> petList = petMapper.selectPetAllByPageNumByPageSize(pageNum, pageSize);
        return petList;
    }
//    查询总条数
    public int selectDataCount(){
        int count = petMapper.selectDataCount();
        return count;
    }


}
